<?php
if(!defined('W_ROOT')) {
	exit();
}
    if(!empty($_GET['id'])){
		 $ids=(int)$_GET['id'];
		 $_SESSION['id_for']=$ids;
	}
    $selete_edit="SELECT *FROM tbl_advertisement WHERE adv_id='".$ids."'";
	$run_query=mysql_query($selete_edit);
	$num_rows=mysql_num_rows($run_query);
	if($num_rows>0){
	    while(($rows=mysql_fetch_array($run_query,MYSQL_ASSOC)) ){

			 $advertise_title= $rows['adv_title'];
			 $advertise_datepost=$rows['adv_datepost'];
			 $advertise_dateEndpost=$rows['adv_dateendpost'];
			 $advertise_link=$rows['adv_addlink'];
			 $advertise_description=$rows['adv_description'];
			 $page = $rows['adv_page'];
			 $image=$rows['adv_upload_image'];
			 $position=$rows['adv_position'];

			}
	}
?>
<div class="breadcrumb">
        <a href="<?php echo base_url_admin;?>"><?php echo $lang['HOME'];?></a>
         ::<a href="index.php?view=list"><?php echo $lang['ADVERTISE_MANAGE']; ?></a>
      	 ::Edit Advertise
      </div>
<div class="box">
	<?php echo @$error_msg; ?>
<div class="heading">
	<h1><img src="../templates/image/report.png" alt="" />
		Eit Advertisement
	</h1>
	<div class="buttons">
	<form action="process.php?action=edit&id=<?php echo $ids ?>"  method="post" name="frmlist" enctype="multipart/form-data">
		<input class="button" type="submit" name="btnupdate" value="Save"/>&nbsp;&nbsp;&nbsp;
		<input class="button" type="reset" name="btnreset" value="Reset" />&nbsp;&nbsp;&nbsp;
		<input class="button" type="button" name="btncancel" value="Cancel" onClick="javascript:window.history.back();" />
	</div>
	</div>
	<div class="content">
<div class="row">
<table cellpadding="5" cellspacing="5" border="0" width="100%" align="center">
<tr>
   <td width="10%" height="30" align="left" valign="top">Advertise Title</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input name="txttitle" type="text" placeholder="Advertise title" alt="required" id="txttitle"  value="<?php echo $advertise_title; ?>" required />
   </td>
</tr>
<tr>
   <td width="10%" height="30" align="left" valign="top">Upload Image</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input name="txtimage" type="file"/>
   </td>

</tr>
<tr>
   <td width="10%" height="30" align="left" valign="top">AddLink Image</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input name="txtaddlink" placeholder="Add Link"  type="text"  id="txtmeta_desc"  value="<?php echo $advertise_link; ?>"  /> <span style="color:#F00;"> &nbsp;&nbsp;* Note: (https://www.google.com)</span>
   </td>
</tr>

<tr>
   <td width="10%" height="30" align="left" valign="top">Date Post</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input name="txtpost" type="text" placeholder="DatePost"  id="datepicker" value="<?php echo $advertise_datepost; ?>" />
   </td>
</tr>
<tr>
   <td width="10%" height="30" align="left" valign="top">Date End Post</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input name="txtendpost"  placeholder="DateEnd" class="datepicker" type="text"  value="<?php echo $advertise_dateEndpost; ?>"  />
   </td>
</tr>
<tr>
   <td width="10%" height="30" align="left" valign="top">Description</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">


        <textarea name="txtdescription" style="width:30%;height:100px;"><?php echo $advertise_description; ?></textarea>

   </td>
   <?php
    $se="selected='selected'";
    $right="right";
	$left="left";
	$content="content";
	$bottom="bottom";
   ?>
</tr>
 <tr>
   <td width="10%" height="30" align="left" valign="top"><?php echo $lang['POST_PAGE']; ?></td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
     <select name="txtpage" style="width:300px;" required >
           <option value="">-------------<?php echo $lang['sel_position']; ?>---------------</option>
           <option value="0" <?php echo ($page=='0')?'selected="selected"':''?> ><?php echo $lang['HOME']; ?></option>
           <option value="1" <?php echo ($page=='1')?'selected="selected"':''?>><?php echo $lang['SUB']; ?></option>
     </select>
     &nbsp;&nbsp;<strong style="color:#F00;">*</strong>
   </td>
</tr>
<tr>
   <td width="10%" height="30" align="left" valign="top">Position</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
     <select name="txtposition" style="width:300px;">
           <option>Select position </option>
           <option <?php  if($right==$position){echo $se;}?> value="right">Right</option>
           <option <?php if($position==$left){ echo $se;}?> value="left">Left</option>
		   <option <?php  if($content==$position){echo $se;}?> value="content">Content</option>
           <option <?php  if($bottom==$position){echo $se;}?>  value="bottom">Bottom</option>
     </select>

   </td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>
</table>
</form>
</div>
</div><!--<div class="row">-->
<script type="text/javascript" src="<?php echo base_url; ?>admin/templates/javascript/ckeditor/ckeditor.js"></script>
<script>
    $(document).ready(function() {
        CKEDITOR.replace('txtdesc', {});
    });
    $('#tabs a').tabs();
</script>

<script src="js/jquery.js" type="text/javascript" language="javascript"></script>
